package com.yin.myproject.lb;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * Created by Eason on 2017/8/3.
 */
public class RoundRobinSample01Client implements Runnable {

    public static void main(String[] args) {
        ExecutorService service = Executors.newFixedThreadPool(10);
        for (int i = 0; i < 10; i++) {
//            new Thread(new RoundRobinSample01Client()).start();
            service.execute(new RoundRobinSample01Client());
        }
    }

    @Override
    public void run() {
        while (true) {
            String server = RoundRobinSample01.getServer();
            System.out.println(server + "" + Thread.currentThread().getName());
        }
    }
}
